<!--
 * @Author: wangshuguang
 * @Date: 2022-03-11 10:46:34
 * @LastEditTime: 2022-03-31 14:31:08
 * @LastEditors: wangshuguang
 * @Description: 会员储值详情
-->
<template>
  <div class="memberSharedDetail">
    <HeaderComp title="会员开卡详情" />
    <van-form input-align="right" readonly>
      <!-- 顾客在收银小程序中开通无门槛会员卡 -->
      <div v-if="form.infoType == 1">
        <van-field :value="form.vipName" label="会员" />
        <van-field :value="form.openAmount" label="开卡金额" />
        <van-field :value="form.sourceCodeZh" label="业务来源" />
        <van-field :value="form.shopName" label="注册门店" />
        <van-field :value="form.promoteName" label="推广人" />
        <van-field :value="form.openCardTime" label="开卡时间" />
      </div>
      <!-- 顾客在商户小程序中开通有门槛会员卡 -->
      <div v-else-if="form.infoType == 2">
        <van-field :value="form.vipName" label="会员" />
        <van-field :value="form.vipPhone" label="手机号" />
        <van-field :value="form.cardName" label="会员卡" />
        <van-field :value="form.openAmount" label="开卡金额" />
        <van-field :value="form.sourceCodeZh" label="业务来源" />
        <van-field :value="form.shopName" label="注册门店" />
        <van-field :value="form.promoteName" label="推广人" />
        <van-field :value="form.openCardTime" label="开卡时间" />
        <van-field :value="form.tranStatus" label="状态" />
      </div>
      <!-- 老会员赠送会员卡 -->
      <div v-else-if="form.infoType == 3">
        <van-field :value="form.vipName" label="会员" />
        <van-field :value="form.vipPhone" label="手机号" />
        <van-field :value="form.cardName" label="会员卡" />
        <van-field :value="form.openAmount" label="开卡金额" />
        <van-field :value="form.sourceCodeZh" label="业务来源" />
        <van-field :value="form.givingPerson" label="赠送人" />
        <van-field :value="form.givingTime" label="赠送时间" />
        <van-field :value="form.getTime" label="领取时间" />
        <van-field :value="form.tranStatus" label="状态" />
        <van-field :value="form.remark" label="备注" />
      </div>
      <!-- 顾客领取会员卡后，原记录更新字段内容 -->
      <div v-else-if="form.infoType == 4">
        <van-field :value="form.vipName" label="会员" />
        <van-field :value="form.vipPhone" label="手机号" />
        <van-field :value="form.cardName" label="会员卡" />
        <van-field :value="form.openAmount" label="开卡金额" />
        <van-field :value="form.sourceCodeZh" label="业务来源" />
        <van-field :value="form.givingPerson" label="赠送人" />
        <van-field :value="form.givingTime" label="赠送时间" />
        <van-field :value="form.getTime" label="领取时间" />
        <van-field :value="form.tranStatus" label="状态" />
        <van-field :value="form.remark" label="备注" />
      </div>
      <!-- 赠送卡超时未领取，自动退回后 -->
      <div v-else-if="form.infoType == 5">
        <van-field :value="form.vipName" label="会员" />
        <van-field :value="form.vipPhone" label="手机号" />
        <van-field :value="form.cardName" label="会员卡" />
        <van-field :value="form.openAmount" label="开卡金额" />
        <van-field :value="form.sourceCodeZh" label="业务来源" />
        <van-field :value="form.givingPerson" label="赠送人" />
        <van-field :value="form.givingTime" label="赠送时间" />
        <van-field :value="form.invalidTime" label="退回时间" />
        <van-field :value="form.tranStatus" label="状态" />
        <van-field :value="form.remark" label="备注" />
      </div>
    </van-form>
  </div>
</template>

<script>

import { dateFtt, isTrue } from "@/utils/utils";
import { mapGetters } from "vuex";
export default {
  data(){
    return {
      dateFtt,
      form:{}
    }
  },
  computed:{
    ...mapGetters(['flowQueryData'])
  },
  mounted(){
    console.log('this.$route.query',this.$route.query)
    let _query = this.$route.query
    this.form = { 
      ..._query,
      vipName: this.fmtValue(_query.vipName),
      vipPhone: this.fmtValue(_query.vipPhone),
      // givingTime: this.fmtDate(_query.givingTime),
      // getTime: this.fmtDate(_query.getTime),
      // invalidTime: this.fmtDate(_query.invalidTime),
      //openCardTime: this.fmtDate(_query.openCardTime),
	  givingTime: _query.givingTime,
	  getTime: _query.getTime,
	  invalidTime:_query.invalidTime,
	  openCardTime: _query.openCardTime,
	  
    }
	console.log('this.form',this.form)
  },
  methods:{
    // 格式化普通数据
    fmtValue(val){
      return isTrue(val) ? val : '-'
    },
    // 格式化时间数据
    fmtDate(date){
      if(isTrue(date)){
        return dateFtt('yyyy-MM-dd hh:mm:ss', new Date(date))
      }else{
        return '-'
      }
    }
  }
}
</script>

<style lang="less" scoped>
.memberSharedDetail{
  background: #F9F9F9;
}
</style>
